package com.blog1.pojo.response;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.time.LocalDate;

@Data
public class BlogInfoListResult {
    private int id;
    private String title;
    private String content;
    private String userId;
    @JsonFormat(pattern = "yyyy年-MM月-dd日")
    private LocalDate time;
    public String getContent() {
        // 如果content为null，则返回空字符串，否则返回content的前30个字符
        return content==null?" ":content.substring(0,20);
    }
}
